////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    FieldOfGreenGuts.h                                           //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 04/13/2007                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Field of Green.               //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2007 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__FIELDOFGREENGUTS_H__)
#define __FIELDOFGREENGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "slotguts.h"

class FieldOfGreenGuts : public SlotGuts
{
public:
	FieldOfGreenGuts();

	virtual ~FieldOfGreenGuts();

private:
	// Shared enums between client and server
	#include "FieldOfGreenCommon.h"

	// Probability Tables
    enum ProbabilityTables
    {
		PROB_TABLE_KICK_RESULTS
	};

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	enum EvalType
	{
		etLeftToRight,
		etRightToLeft
	};

	// Helper functions for classifyStops.
	SpinResult getLineWinResultWithPossibleSubstitution(
		uint8* stops, uint8 line, EvalType et, bool& bSubstitution );

	bool doesRightToLeftLineWinPayMore( SpinResult srLeftToRight, bool bLeftToRightSubstitution,
		SpinResult srRightToLeft, bool bRightToLeftSubstitution ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	void evaluateFeatureTriggerSteps(  SlotSpin* spin );

	SpinResult getScatterResult( SlotSpin* spin, EvalType et, int32& nNumIcons, int32& nPositions ) const;
	
	void addScatter( SlotSpin* spin, SpinResult srResult, int32 nPositions );
	void addFeatureTriggerScatter( SlotSpin* spin, int32 nNumIcons, int32 nPositions );

	void addBonus( uint8 nResult );

	// Sub-game data accessors.
	uint8 getKickResult( int32 nKick );
	void setKickResult( int32 nKick , uint8 nResult );

	uint8 getCurrentKick();
	void setCurrentKick( uint8 nKick );
	void incrementCurrentKick();

	uint8 getNumKicks();
	void setNumKicks( uint8 nKicks );

	void setRightToLeftLineWin( uint8 nLine );
	void resetRightToLeftLineWins();

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

	virtual bool8 processClientData( uint8 bonusGameType, int32 bonusDataCount, int32 *bonusData );

protected:
	// Override these framework functions.
	virtual void resetDataForNextSpin();
	virtual bool8 hasSavedGames();
};


#endif // !defined(__FIELDOFGREENGUTS_H__)
